1. Field of the Invention
The present invention relates to a compression coding technique of image data.
2. Description of the Related Art
JPEG as an international standard encoding scheme of still image data includes lossy coding that exploits the discrete cosine transform (DCT) and lossless coding using predictive coding. Also, JPEG specifies coding/decoding processing of color image data of 8 bits per color component and color image data of 12 bits per color component. Coding of an 8-bit image using the DCT is dubbed baseline JPEG, and coding of a 12-bit image including 8 bits is dubbed extended JPEG and distinguished from the former. The present invention relates to lossy coding using the DCT.
Details are described in Section B.2.2. “Frame header syntax” of Annex B of “ITU-T recommendation T.81 (ISO/IEC 10918-1)”. Table B.2 in Section B.2.2. of this reference specifies the sizes and values of frame header parameters, and also the numbers of bits of image data to be coded/decoded as the second parameter P. Baseline JPEG sequential DCT is limited to only an 8-bit image, and extended sequential DCT and progressive DCT can code/decode 8-bit and 12-bit images. The number of coded bits in image data is described in the frame header parameter. Since decoding processing is done based on that parameter, the number of bits of coded image data is equal to the number of bits of image data after decoding for both the numbers of bits.
A color image input device used so far generates data with a precision of 8 bits or less per color component in terms of technical problems and cost. Therefore, JPEG compression or simply JPEG generally means baseline JPEG that compresses 8-bit data.
In recent years, along with the improvement of the precision of an image input device, a digital camera, scanner, and the like can easily generate image data with a precision over 8 bits. Hence, the necessity of extended JPEG that can compress 12-bit data is increasing.
A major difference between extended JPEG and baseline JPEG is that in the former the number of bits of input data is 12 bits (increased by 4 bits), and is extended so that a color converter, DCT transformer, and quantizer can process 16-fold values (precision).
The extended JPEG coding processing flow of a 12-bit image per color component will be described below using the block diagram shown in FIG. 1. Referring to FIG. 1, reference numeral 101 denotes input 12-bit image data per color component. Reference numeral 103 denotes a color converter; and 105, a level shifter. Reference numeral 107 denotes a DCT transformer; 109, a quantizer; and 111, a Huffman coder. Reference numeral 113 denotes a quantization table storage unit; and 115, coded data generated by the coding processing.
When three components of a full-color image are three primary colors R, G, and B, the color converter 103 converts the three primary colors R, G, and B into Y, Cb, and Cr as luminance and color difference signals. This color conversion normally uses following formulas that comply with ITU-R BT.601:Y=0.299×R+0.587×G+0.114×B Cb=(−0.299×R−0.587×G+0.886×B)×0.564Cr=(0.701×R−0.587×G−0.114×B)×0.713
Next, the level shifter 105 executes processing given by:Y′=Y−k where a value k=2048 is used in 12-bit data conversion.
The color-converted Y, Cb, and Cr components are transformed into DCT coefficients by the DCT transformer 107, and the DCT coefficients are sent to the quantizer 109.
In extended JPEG, since image data is expanded from 8 bits to 12 bits compared to baseline JPEG, the range is expanded to about 16 times. Since color conversion and DCT transformation adopt linear conversion, 16-fold expanded data is still 16-fold expanded after conversion. Therefore, the DCT coefficients in extended JPEG are 16 times those in baseline JPEG.
The quantizer 109 converts the DCT coefficients into quantization values by dividing them by a quantization step value read out from the quantization table storage unit 113. When the 16-fold expanded DCT coefficients are quantized using a quantization table for baseline JPEG, quantization values also become 16 times. The 16-fold quantization values are sent to the Huffman coder 111.
The Huffman coder 111 generates the coded data 115 by Huffman-coding the quantization values based on a Huffman table (not shown).
As the Huffman table used upon Huffman-coding the 16-fold quantization value, a Huffman table for baseline JPEG cannot be used, and a table in which Huffman codes are assigned to all combinations of 1- to 16-fold quantization values and zero-runs is required. The required Huffman table size is many greater than that of baseline JPEG.
In header information of the coded data 115, various parameters such as an SOF1 marker indicating the extended JPEG code, the image size, and the like, and quantization table information are written. This is specified by “ITU-T recommendation T.81 (ISO/IEC 10918-1)”.
The processing system shown in FIG. 1 compliant to the extended JPEG coding processing has an implementation that assumes a 12-bit full-range input.
When the conventional processing system codes a 12-bit image by extended JPEG, the following problems are posed.
The range of data accepted by a Huffman table of an entropy coder which can code a 12-bit image has a many greater table than that for baseline JPEG, resulting in an increase in circuit scale of the entropy coder.
In order to efficiently compress images having different numbers of bits, Huffman tables dedicated to the respective numbers of bits must be prepared, and the scale of all the Huffman tables still increases. That is, Huffman tables for 8-, 9-, 10-, 11-, and 12-bit images are required.